package com.cizzy.video.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.cizzy.video.common.Result;
import com.cizzy.video.entity.dao.VideoCountDAO;
import com.cizzy.video.service.IVideoCountService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author crissy-月下闲人
 * @since 2023-10-29
 */
@Controller
@RequestMapping("/videoCount")
//@SentinelResource("videoCount")
public class VideoCountController {

    @Resource
    private IVideoCountService videoCountService;

    @ResponseBody
    @GetMapping("/getVideoCountById/{id}")
    public Result<VideoCountDAO> getVideoCountById(@PathVariable("id") Long id) {
        return videoCountService.getVideoCountById(id);
    }

    @ResponseBody
    @PostMapping("/addVideoCountById")
    public Result<VideoCountDAO> addVideoCountById(@RequestParam("column") String column, @RequestParam("id") Long id, @RequestParam("count") Integer count) {
        return videoCountService.addVideoCountById(column, id, count);
    }
}
